/**
 * 
 */
package org.extdev.libraries.ltr;

import com.sun.jna.Structure;

/**
 * @author LAP
 *
 */
public class INFO_LTR11 extends Structure {
	public String name;
	public String serial;
	
	public short ver;
	
	public String date;
	
	public CbrCoeff[] cbrCoef = new CbrCoeff[LTR11APIConstants.LTR11_ADC_RANGEQNT];
	
	public INFO_LTR11() {
		super();
		initFieldOrder();
	}
	
	public INFO_LTR11(String name, String serial, short ver, String date, CbrCoeff[] cbrCoeffs) {
		this.name = name;
		this.serial = serial;
		this.ver = ver;
		this.date = date;
		if (this.cbrCoef.length != cbrCoeffs.length)
			throw new IllegalArgumentException("Wrong array size !");
		cbrCoef = cbrCoeffs;
	}
	
	protected void initFieldOrder() {
		setFieldOrder(new String[] {"name", "serial", "ver", "date", "cbrCoef"});
	}	
	
	public static class CbrCoeff extends Structure {
		public double offset;
		public double gain;
		
		public CbrCoeff() {
			super();
			initFieldOrder();
		}
		
		public CbrCoeff(double offset, double gain) {
			super();
			this.offset = offset;
			this.gain = gain;
			initFieldOrder();
		}
		
		protected void initFieldOrder() {
			setFieldOrder(new String[] {"offset", "gain"});
		}
		
		public static class ByReference extends CbrCoeff implements Structure.ByReference{};
		public static class ByValue extends CbrCoeff implements Structure.ByValue{};
	}
	
	public static class ByReference extends INFO_LTR11 implements Structure.ByReference{};
	public static class ByValue extends INFO_LTR11 implements Structure.ByValue{};
}
